#define _CRT_SECURE_NO_WARNINGS	

#include<stdio.h>

int main()
{
    int x;
    scanf("%d", &x);
    if (x > 31)
        printf("Error\n");
    else
    {
        int y = (x - 1 + 3 - 1) % 7 + 1;
        switch (y)
        {
        case 1:
            printf("Monday\n");
            break;
        case 2:
            printf("Tuesday\n");
            break;
        case 3:
            printf("Wednesday\n");
            break;
        case 4:
            printf("Thursday\n");
            break;
        case 5:
            printf("Friday\n");
            break;
        case 6:
            printf("Saturday\n");
            break;
        case 7:
            printf("Sunday\n");
            break;
        default:
            printf("error\n");
        }
    }
    return 0;
}